// 获取多选框
var ipts = document.querySelectorAll(".wwh-yuyue-con-box ul li input")
ipts[0].checked = true
console.log(ipts[0].checked);


// 获取li
var lis = document.querySelectorAll(".wwh-yuyue-con-box ul li")
console.log(lis);

// 选中input框
for (var i = 0; i < ipts.length; i++) {
  ipts[i].index = i
  ipts[i].onclick = function () {
    if (this.checked == true) {
      lis[this.index].style.backgroundColor = "red"
      lis[this.index].style.color = "#fff"
    } else {
      lis[this.index].style.backgroundColor = "#fff"
      lis[this.index].style.color = "#666"
    }
    button(this.index)
  }

}


// 获取input
var ipt = document.querySelectorAll(".wwh-input input")
// 点击input,，遍历
// for(var i=0;i<ipt.length;i++){
//   ipt[i].onfocus=function(){
//     this.style.border="1px solid blue"
//   }
//   ipt[i].onblur=function(){
//     this.style.border="1px solid #ccc"
//   }
// }
// 获取提交按钮
var btn = document.querySelector(".wwh-yuyue-nav div")
function button(num) {
  btn.onclick = function () {
    if (ipt[0].value == "") {
      alert("请输入称呼")
    } else if (ipt[1].value == "") {
      alert("请输入手机号")
    } else if (num == null) {
      alert("请选则预约项目")
    } else {
      ipt[0].value = ''
      ipt[1].value = ''
      alert("预约成功")
      for (var i = 0; i < ipts.length; i++) {
        ipts[i].checked = 'false'
        lis[i].style.backgroundColor = "#fff"
        lis[i].style.color = "#666"
      }
    }
  }
}
button()